<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>商品列表</title>
</head>
<body>
{% include "header.html" %}
<form>
	<table width="50%" style="text-align: center" align="center">
		<tr>
			<th colspan="4" style="font-size: 26px"> 商品列表</th>
		</tr>
		<tr>
			<th>商品序号</th>
			<th>商品名字</th>
			<th>商品价格</th>
			<th>商品图片</th>
			<th>下载量</th>
			<th>下载商品</th>
		</tr>
		{% for goods in pages.items %}
			<tr>
				<td>{{ goods.id }}</td>
				<td>{{ goods.name }}</td>
				<td>{{ goods.price }}</td>
				<td><img src="{{ goods.img }}" width="50px"></td>
				<td>{{ goods.count }}</td>
				<td><a href="/download/{{ goods.id }}" id="down">下载</a></td>
			</tr>
		{% endfor %}
	</table>
	<p align="center">
		{% if pages.prev_num %}
			<a href="/page?pag_num={{ pages.prev_num }}">上一页</a>

		{% endif %}
		{% for page in pages.iter_pages() %}
			<a href="/page?pag_num={{ page }}">{{ page }}</a>
		{% endfor %}
		{% if pages.has_next %}
			<a href="/page?pag_num={{ pages.next_num }}">下一页</a>

		{% endif %}
	</p>
</form>
<script src="/static/news/js/jquery-1.12.4.min.js"></script>
<script>
    $("#down").click(function () {
        $.ajax({
            url: "/page",
            method: "get",
            success: function () {
                {#window.location.href = "/page";#}
				window.history.go(0)
            },
        })
    });
</script>
</body>
</html>